package leetcode.code004;

import leetcode.IDebug;
import leetcode.helper.HelpDebug;

public abstract class Solution004 implements IDebug {

	public abstract double findMedianSortedArrays(int[] nums1, int[] nums2);

	private void debug(String str1, String str2, double expect) {
		int[] nums1 = HelpDebug.str2array31(str1);
		int[] nums2 = HelpDebug.str2array31(str2);
		double result = this.findMedianSortedArrays(nums1, nums2);
		HelpDebug.compare(expect, result);
	}

	@Override
	public void debug1() {
		String str1 = "[1,3]";
		String str2 = "[2]";
		double expect = 2;
		debug(str1, str2, expect);
	}

	@Override
	public void debug2() {
		String str1 = "[1,2]";
		String str2 = "[3,4]";
		double expect = 2.5;
		debug(str1, str2, expect);
	}

	@Override
	public void debug3() {
		String str1 = "[0,0]";
		String str2 = "[0,0]";
		double expect = 0;
		debug(str1, str2, expect);
	}

	@Override
	public void debug4() {
		String str1 = "[]";
		String str2 = "[1]";
		double expect = 1;
		debug(str1, str2, expect);
	}

	public void debug5() {
		String str1 = "[2]";
		String str2 = "[]";
		double expect = 2;
		debug(str1, str2, expect);
	}

	public void debug6() {
		String str1 = "[2]";
		String str2 = "[1,3,4,5]";
		double expect = 3;
		debug(str1, str2, expect);
	}

	public void debug7() {
		String str1 = "[4,5]";
		String str2 = "[1,2,3,6,7]";
		double expect = 4;
		debug(str1, str2, expect);
	}

}
